package es.tiare;

import java.util.ArrayList;
import java.util.List;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.hibernate.Criteria;
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;
import org.testng.annotations.Test;

import es.tiare.persistance.Persistencia;


public class NewTest2 {
	
  protected final Log logger = LogFactory.getLog(getClass());
	
  @Test
  public void f() {
	  
	  System.out.println("pruebas testng");
	  
	  Session ses = Persistencia.getSessionFactory().openSession();
	  
	  try {
          Transaction tx = ses.beginTransaction();
               
          Query query = ses.createQuery("from categorias");
          List categoria = query.list();
    	  
          System.out.println(categoria);
          
    	  tx.commit();
          ses.close();
                
	  } catch (Exception e) {
		// TODO: handle exception
		  e.printStackTrace();
	}
	 
  }
}
